/*
 * Copyright rgil2010
 * All rights reserved
 */

package com.test.jdbc.connection;

import com.test.appli.mysql.names.Names;
import com.test.jdbc.Def;
import java.sql.ResultSet;

/**
 *
 * @author user
 */
public class ConAddClt extends ConAbs{
    public ConAddClt() throws Exception{
        super();
    }

    @Override
    public boolean doJob() throws Exception {
        this._dbConnection_.connect("", "root", "0");
        this._dbConnection_.executeUpdate(Def.useDB(Names.db));
 
        this._dbConnection_.executeQuerry(Def.countElements(Names.tablePrt));
        ResultSet result = this._dbConnection_.getResult();
        String strId = "";
        while(result.next())
        {
            strId = ((Integer)(result.getInt(1) +1)).toString();
        }
        
        String strCommand =
            Def.insertIntoTable(Names.tablePrt)+
            Def.addField(strId) +
            Def.addField(this.strIdentiteNom_) +
            Def.addField(this.strIdentitePrenom1_) +
            Def.addField(this.strIdentitePrenom2_) +
            Def.addField(this.strIdentitePrenom3_) +
            Def.addField(this.strIdentiteSexe_) +
            Def.addField(this.strIdentiteDateNaissance_) +
            Def.addField(this.strPersonnelMail_) +
            Def.addField(this.strTravailMail_) +
            Def.addField(this.strPersonnelFixe_) +
            Def.addField(this.strTravailFixe_) +
            Def.addField(this.strPersonnePortable_) +
            Def.addField(this.strTravailPortable_) +
            Def.addField(this.strAdresseVoie_) +
            Def.addField(this.strAdresseNumero_) +
            Def.addField(this.strAdresseLigne1_) +
            Def.addField(this.strAdresseLigne2_) +
            Def.addField(this.strAdresseCode_) +
            Def.addField(this.strAdresseVille_) +
            Def.addLastField(this.strAdressePays_);


       this._dbConnection_.executeUpdate(strCommand);
       this._dbConnection_.disconnect();

       return true;
    }


    public void setValues(String strIdentiteNom,
        String strIdentitePrenom1,
        String strIdentitePrenom2,
        String strIdentitePrenom3,
        String strIdentiteSexe,
        String strIdentiteDateNaissance,
        String strPersonnelMail,
        String strTravailMail,
        String strPersonnelFixe,
        String strTravailFixe,
        String strPersonnePortable,
        String strTravailPortable,
        String strAdresseVoie,
        String strAdresseNumero,
        String strAdresseLigne1,
        String strAdresseLigne2,
        String strAdresseCode,
        String strAdresseVille,
        String strAdressePays)
    {
        this.strIdentiteNom_ = strIdentiteNom;
        this.strIdentitePrenom1_ = strIdentitePrenom1;
        this.strIdentitePrenom2_ = strIdentitePrenom2;
        this.strIdentitePrenom3_ = strIdentitePrenom3;
        this.strIdentiteSexe_ = strIdentiteSexe;
        this.strIdentiteDateNaissance_ = strIdentiteDateNaissance;
        this.strPersonnelMail_ = strPersonnelMail;
        this.strTravailMail_ = strTravailMail;
        this.strPersonnelFixe_ = strPersonnelFixe;
        this.strTravailFixe_ = strTravailFixe;
        this.strPersonnePortable_ = strPersonnePortable;
        this.strTravailPortable_ = strTravailPortable;
        this.strAdresseVoie_ = strAdresseVoie;
        this.strAdresseNumero_ = strAdresseNumero;
        this.strAdresseLigne1_ = strAdresseLigne1;
        this.strAdresseLigne2_ = strAdresseLigne2;
        this.strAdresseCode_ = strAdresseCode;
        this.strAdresseVille_ = strAdresseVille;
        this.strAdressePays_ = strAdressePays;

    }

    protected String strIdentiteNom_;
    protected String strIdentitePrenom1_;
    protected String strIdentitePrenom2_;
    protected String strIdentitePrenom3_;
    protected String strIdentiteSexe_;
    protected String strIdentiteDateNaissance_;
    protected String strPersonnelMail_;
    protected String strTravailMail_;
    protected String strPersonnelFixe_;
    protected String strTravailFixe_;
    protected String strPersonnePortable_;
    protected String strTravailPortable_;
    protected String strAdresseVoie_;
    protected String strAdresseNumero_;
    protected String strAdresseLigne1_;
    protected String strAdresseLigne2_;
    protected String strAdresseCode_;
    protected String strAdresseVille_;
    protected String strAdressePays_;


}
